<?php

$host = '0.0.0.0';
$port = 9501;
$serv = new swoole_server($host,$port);

$serv->on('Connect',function($serv, $fd){
    echo "连接成功"."\n";
});


$serv->on('Receive',function($serv, $fd, $from_id, $data){
    $serv->send($fd,"接收到消息:".$data);
    $serv->close($fd);
});

$serv->on('Close',function($serv, $fd){
    echo "连接关闭"."\n";
});


$serv->start();
